﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PortalParts/PageMoreBranch.Master" AutoEventWireup="true" CodeBehind="BranchMember.aspx.cs" Inherits="ZHDJ.Web.Portal.BranchHome.BranchMember" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <link href="../../Resource/js/Nailthumb/jquery.nailthumb.1.1.min.css" rel="stylesheet" />

    <script src="../../Resource/js/Nailthumb/jquery.nailthumb.1.1.min.js"></script>
    <script src="../../Resource/js/default/jquery.tmpl.min.js"></script>
    <script src="../../Resource/js/knockout/knockout-3.4.0.js"></script>
    <script src="/Resource/js/jquery/jquery.pagination.js"></script>
    <script>
        var pageSize = 9, isBind = false;
        var initImgSize = function () {
            $('.nailthumb-container').each(function (i, n) {
                $(n).nailthumb({ width: 240, height: 180, method: 'crop', fitDirection: 'center center' });
            });

        }
        var paginationPara = {
            num_edge_entries: 1, //边缘页数
            num_display_entries: 4, //主体页数
            callback: pageselectCallback,
            items_per_page: pageSize, //每页显示1项
            prev_text: "上一页",
            next_text: "下一页",
            link_to: "javascript:void(0);"
        }
        var ViewModel = {
            qdate: ko.observableArray(),
            loadContacts: function (pageIndex) {
                $.get("BranchMember.aspx", {
                    PageIndex: pageIndex ,
                    PageSize: pageSize,
                    BranchID: $("#ctl00_ContentPlaceHolder3_hdBranchID").val(),
                    r: (new Date()).getTime()
                },
                function (data) {
                    var ss = eval("(" + data + ")");
                    
                    ViewModel.qdate(eval("(" + data + ")"));
                });
            }
        }

        function initPage() {
            $.get("BranchMember.aspx", { DataCount: 1, BranchID: $("#ctl00_ContentPlaceHolder3_hdBranchID").val(), r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    $("#pagination").pagination(totalCount, paginationPara);
                });
        }
        function pageselectCallback(pageIndex, jq) {
            ViewModel.loadContacts(pageIndex);
            if (!isBind) {
                ko.applyBindings(ViewModel);
                isBind = true;
            }
            
        }
        $(function () {
            initPage();
        });



    </script>
    <script id="myTemplate" type="text/x-jquery-tmpl">
        <li class="imgbox">
            <a href="javascript:void(0);" target="_blank">
                <div class="nailthumb-container ">
                    <img src="${ImgUrl}" />
                </div>
            </a>
            <div class="titled">${UserName}</div>
        </li>
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">

    <asp:HiddenField ID="hdBranchID" runat="server" />
    <asp:Label runat="server" ID="dd"> </asp:Label>
    <div class="ny_box" style="min-height:460px;margin-top: 20px;">
        <ul class="ulimg" data-bind="template: { name: 'myTemplate', foreach: qdate,afterRender: initImgSize}" >
        </ul>
        <div style="clear:both"></div>
        <div class="pagination">
            <div id="pagination">
            </div>
        </div>
    </div>

</asp:Content>
